#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

// 2966. 划分数组并满足最大差限制
// https://leetcode.cn/problems/divide-array-into-arrays-with-max-difference/description/?envType=daily-question&envId=2025-06-18

class Solution
{
public:
    vector<vector<int>> divideArray(vector<int> &nums, int k)
    {
        vector<vector<int>> ans;
        sort(nums.begin(), nums.end());
        for (int i = 0; i < nums.size(); i += 3)
        {
            if(nums[i+2] - nums[i] > k){
                return {};
            }
            vector<int> curNum(nums.begin() + i, nums.begin() + i + 3);
            ans.push_back(curNum);
        }
        return ans;
    }
};

int main()
{
    return 0;
}